package com.crane.framework.vo;

import lombok.Data;
import lombok.Getter;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;

import java.io.Serial;
import java.io.Serializable;

import java.time.LocalDateTime;
import java.util.Date;
import io.swagger.v3.oas.annotations.media.Schema;

import org.hibernate.validator.constraints.Length;

/**
 * @Author: ten.x @TableName sys_file @Date: 2024-01-18 04:32:48 @Version: V1.0
 */
@Data
@Accessors(chain = true)
@TableName(value = "sys_file")
@EqualsAndHashCode(callSuper = false)
public class FileDetailVO implements Serializable {

  @Serial
  @TableField(exist = false)
  private static final long serialVersionUID = 1L;

  /** 主键：文件id */
  @TableId(value = "id")
  @Schema(description = "文件id")
  @Length(max = 64, message = "编码长度不能超过64")
  private String id;

  /** 文件访问地址 */
  @NotBlank(message = "[文件访问地址]不能为空")
  @Size(max = 512, message = "编码长度不能超过512")
  @TableField(value = "url")
  @Schema(description = "文件访问地址")
  @Length(max = 512, message = "编码长度不能超过512")
  private String url;

  /** 文件大小，单位字节 */
  @TableField(value = "size")
  @Schema(description = "文件大小，单位字节")
  private String size;

  /** 文件名称 */
  @Size(max = 256, message = "编码长度不能超过256")
  @TableField(value = "filename")
  @Schema(description = "文件名称")
  @Length(max = 256, message = "编码长度不能超过256")
  private String filename;

  /** 原始文件名 */
  @Size(max = 256, message = "编码长度不能超过256")
  @TableField(value = "original_filename")
  @Schema(description = "原始文件名")
  @Length(max = 256, message = "编码长度不能超过256")
  private String originalFilename;

  /** 基础存储路径 */
  @Size(max = 256, message = "编码长度不能超过256")
  @TableField(value = "base_path")
  @Schema(description = "基础存储路径")
  @Length(max = 256, message = "编码长度不能超过256")
  private String basePath;

  /** 存储路径 */
  @Size(max = 256, message = "编码长度不能超过256")
  @TableField(value = "path")
  @Schema(description = "存储路径")
  @Length(max = 256, message = "编码长度不能超过256")
  private String path;

  /** 文件扩展名 */
  @Size(max = 32, message = "编码长度不能超过32")
  @TableField(value = "ext")
  @Schema(description = "文件扩展名")
  @Length(max = 32, message = "编码长度不能超过32")
  private String ext;

  /** MIME类型 */
  @Size(max = 128, message = "编码长度不能超过128")
  @TableField(value = "content_type")
  @Schema(description = "MIME类型")
  @Length(max = 128, message = "编码长度不能超过128")
  private String contentType;

  /** 存储平台 */
  @Size(max = 32, message = "编码长度不能超过32")
  @TableField(value = "platform")
  @Schema(description = "存储平台")
  @Length(max = 32, message = "编码长度不能超过32")
  private String platform;

  /** 缩略图访问路径 */
  @Size(max = 512, message = "编码长度不能超过512")
  @TableField(value = "th_url")
  @Schema(description = "缩略图访问路径")
  @Length(max = 512, message = "编码长度不能超过512")
  private String thUrl;

  /** 缩略图名称 */
  @Size(max = 256, message = "编码长度不能超过256")
  @TableField(value = "th_filename")
  @Schema(description = "缩略图名称")
  @Length(max = 256, message = "编码长度不能超过256")
  private String thFilename;

  /** 缩略图大小，单位字节 */
  @TableField(value = "th_size")
  @Schema(description = "缩略图大小，单位字节")
  private String thSize;

  /** 缩略图MIME类型 */
  @Size(max = 128, message = "编码长度不能超过128")
  @TableField(value = "th_content_type")
  @Schema(description = "缩略图MIME类型")
  @Length(max = 128, message = "编码长度不能超过128")
  private String thContentType;

  /** 文件所属对象id */
  @Size(max = 32, message = "编码长度不能超过32")
  @TableField(value = "object_id")
  @Schema(description = "文件所属对象id")
  @Length(max = 32, message = "编码长度不能超过32")
  private String objectId;

  /** 文件所属对象类型，例如用户头像，评价图片 */
  @Size(max = 32, message = "编码长度不能超过32")
  @TableField(value = "object_type")
  @Schema(description = "文件所属对象类型，例如用户头像，评价图片")
  @Length(max = 32, message = "编码长度不能超过32")
  private String objectType;

  /** 文件元数据 */
  @TableField(value = "metadata")
  @Schema(description = "文件元数据")
  private String metadata;

  /** 文件用户元数据 */
  @TableField(value = "user_metadata")
  @Schema(description = "文件用户元数据")
  private String userMetadata;

  /** 缩略图元数据 */
  @TableField(value = "th_metadata")
  @Schema(description = "缩略图元数据")
  private String thMetadata;

  /** 缩略图用户元数据 */
  @TableField(value = "th_user_metadata")
  @Schema(description = "缩略图用户元数据")
  private String thUserMetadata;

  /** 附加属性 */
  @TableField(value = "attr")
  @Schema(description = "附加属性")
  private String attr;

  /** 文件ACL */
  @Size(max = 32, message = "编码长度不能超过32")
  @TableField(value = "file_acl")
  @Schema(description = "文件ACL")
  @Length(max = 32, message = "编码长度不能超过32")
  private String fileAcl;

  /** 缩略图文件ACL */
  @Size(max = 32, message = "编码长度不能超过32")
  @TableField(value = "th_file_acl")
  @Schema(description = "缩略图文件ACL")
  @Length(max = 32, message = "编码长度不能超过32")
  private String thFileAcl;

  /** 创建时间 */
  @TableField(value = "gmt_create")
  @Schema(description = "创建时间")
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime gmtCreate;
}
